import 'package:seedfour/generated/json/base/json_field.dart';
import 'package:seedfour/generated/json/message_list_entity.g.dart';
import 'dart:convert';

@JsonSerializable()
class MessageListEntity {
  late int total = 0;
  late List<MessageData> data = [];

  MessageListEntity();

  factory MessageListEntity.fromJson(Map<String, dynamic> json) =>
      $MessageListEntityFromJson(json);

  Map<String, dynamic> toJson() => $MessageListEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class MessageData {
  late int id = 0;
  late int type = -1;
  late int createdAt = 0;
  late String title = '';
  late String content = '';
  late String orderId = '';
  late int readStatus = 0;

  MessageData();

  factory MessageData.fromJson(Map<String, dynamic> json) =>
      $MessageDataFromJson(json);

  Map<String, dynamic> toJson() => $MessageDataToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
